#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
#define ll long long
int n;
int a[maxn]={0},b[maxn]={0},key[maxn]={0};
int main(){

    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    scanf("%d",&n);
    int k=0;
    for(int i=1;i<=n;i++){
       scanf("%d",&a[i]);
    }
    sort(a+1,a+n+1);
    for(int i=1;i<=n;i++){
       if(key[a[i]]==0){
        k++;
        key[a[i]]=k;
       }
       b[key[a[i]]]++;
    }
    int ans=0;
    int yu=b[k];
    for(int i=k;i>=2;i--){
        if(b[i]>=b[i-1]){
            yu=yu-b[i-1];
            yu+=b[i-1];
        }else{
            if(yu>=b[i-1]-b[i]){
                yu=yu-b[i-1];
                yu+=b[i-1];
            }else{
                ans=ans+b[i-1]-yu;
                yu=0;
                yu+=b[i-1];
            }
        }
    }
    ans+=b[k];
    cout<<ans;
    return 0;





}
